<?php

namespace addons\mall;

use app\common\library\Menu;
use app\common\library\UserMenu;
use think\Addons;
use addons\mall\model\User;

/**
 *Mall 插件
 */
class Mall extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {

        //管理端菜单        
        $adminmenu = [
            [
                'name'    => 'mall',
                'title'   => '商城',
                'icon'    => 'fa fa-building',
                'sublist' => [                    
                    [
                        'name'    => 'mall/oper',
                        'title'   => '运营',
                        'icon'    => 'fa fa-hand-o-up',
                        'sublist' => [
                            [
                                'name'    => 'mall/oper/nav',
                                'title'   => '商城导航',
                                'icon'    => 'fa fa-map-signs',
                                'sublist' => [
                                    ['name' => 'mall/oper/nav/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/nav/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/nav/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/nav/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/nav/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/adpositions',
                                'title'   => '广告位置',
                                'icon'    => 'fa fa-bars',
                                'sublist' => [
                                    ['name' => 'mall/oper/adpositions/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/adpositions/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/adpositions/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/adpositions/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/adpositions/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/ads',
                                'title'   => '广告内容',
                                'icon'    => 'fa fa-bullhorn',
                                'sublist' => [
                                    ['name' => 'mall/oper/ads/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/ads/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/ads/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/ads/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/ads/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/help',
                                'title'   => '系统帮助',
                                'icon'    => 'fa fa-question-circle-o',
                                'sublist' => [
                                    ['name' => 'mall/oper/help/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/help/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/help/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/help/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/help/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/helpcat',
                                'title'   => '帮助分类',
                                'icon'    => 'fa fa-braille',
                                'sublist' => [
                                    ['name' => 'mall/oper/helpcat/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/helpcat/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/helpcat/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/helpcat/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/helpcat/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/friendlink',
                                'title'   => '友情链接',
                                'icon'    => 'fa fa-link',
                                'sublist' => [
                                    ['name' => 'mall/oper/friendlink/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/friendlink/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/friendlink/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/friendlink/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/friendlink/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/express',
                                'title'   => '快递公司',
                                'icon'    => 'fa fa-truck',
                                'sublist' => [
                                    ['name' => 'mall/oper/express/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/express/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/express/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/express/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/express/multi', 'title' => 'Multi'],
                                ]
                            ],
                        	[
                        		'name'    => 'mall/oper/area',
                        		'title'   => '地区设置',
                        		'icon'    => 'fa fa-file-text-o',
                        		'sublist' => [
                        			['name' => 'mall/oper/area/index', 'title' => 'View'],
                        			['name' => 'mall/oper/area/add', 'title' => 'Add'],
                        			['name' => 'mall/oper/area/edit', 'title' => 'Edit'],
                        			['name' => 'mall/oper/area/del', 'title' => 'Del'],
                        			['name' => 'mall/oper/area/multi', 'title' => 'Multi'],
                        		]
                        	],
                        	[
                        		'name'    => 'mall/oper/inform',
                        		'title'   => '举报管理',
                        		'icon'    => 'fa fa-shield',
                        		'sublist' => [
                        			['name' => 'mall/oper/inform/index', 'title' => 'View'],
                        			['name' => 'mall/oper/inform/edit', 'title' => 'Edit'],
                        			['name' => 'mall/oper/inform/del', 'title' => 'Del'],
                        			['name' => 'mall/oper/inform/multi', 'title' => 'Multi'],
                        		]
                        	],
                            [
                                'name'    => 'mall/oper/msgtpl',
                                'title'   => '消息模板',
                                'icon'    => 'fa fa-file-text-o',
                                'sublist' => [
                                    ['name' => 'mall/oper/msgtpl/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/msgtpl/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/msgtpl/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/msgtpl/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/message',
                                'title'   => '消息管理',
                                'icon'    => 'fa fa-commenting-o',
                                'sublist' => [
                                    ['name' => 'mall/oper/message/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/message/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/message/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/message/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/notification',
                                'title'   => '通知管理',
                                'icon'    => 'fa fa-bell-o',
                                'sublist' => [
                                    ['name' => 'mall/oper/notification/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/notification/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/notification/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/notification/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/notification/multi', 'title' => 'Multi'],
                                ]
                            ],
                        ]
                    ],
                    [
                        'name'    => 'mall/goods',
                        'title'   => '商品',
                        'icon'    => 'fa fa fa-barcode',
                        'sublist' => [
                            [
                                'name'    => 'mall/goods/goods',
                                'title'   => '商品管理',
                                'icon'    => 'fa fa-barcode',
                                'sublist' => [
                                    ['name' => 'mall/goods/goods/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/goods/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/goods/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/goods/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/goods/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/goodsattr',
                                'title'   => 'Goodsattr',
                                'icon'    => 'fa fa-list-ul',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/goodsattr/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/goodsattr/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/goodsattr/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/goodsattr/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/goodsattr/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/salespec',
                                'title'   => 'Salespec',
                                'icon'    => 'fa fa-list-ul',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/salespec/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/salespec/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/salespec/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/salespec/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/salespec/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/specitem',
                                'title'   => 'Specitem',
                                'icon'    => 'fa fa-list-ul',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/specitem/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/specitem/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/specitem/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/specitem/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/specitem/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/cat',
                                'title'   => 'Category',
                                'icon'    => 'fa fa-th-large',
                                'sublist' => [
                                    ['name' => 'mall/goods/cat/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/cat/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/cat/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/cat/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/cat/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/goods/catspec',
                                'title'   => '分类规格',
                                'icon'    => 'fa fa-th-list',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/catspec/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/catspec/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/catspec/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/catspec/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/catspec/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/catattr',
                                'title'   => '分类属性',
                                'icon'    => 'fa fa-th-list',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/catattr/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/catattr/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/catattr/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/catattr/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/catattr/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/brands',
                                'title'   => '品牌管理',
                                'icon'    => 'fa fa-500px',
                                'sublist' => [
                                    ['name' => 'mall/goods/brands/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/brands/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/brands/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/brands/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/brands/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/goods/appraise',
                                'title'   => '商品评价',
                                'icon'    => 'fa fa-comments',
                                'sublist' => [
                                    ['name' => 'mall/goods/appraise/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/appraise/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/appraise/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/appraise/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/appraise/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/goods/consult',
                                'title'   => '商品咨询',
                                'icon'    => 'fa fa-handshake-o',
                                'sublist' => [
                                    ['name' => 'mall/goods/consult/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/consult/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/consult/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/consult/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/consult/multi', 'title' => 'Multi'],
                                ],
                            ],

                        ],
                    ],
                    [
                        'name'    => 'mall/order',
                        'title'   => '订单',
                        'icon'    => 'fa fa-money',
                        'sublist' => [
                            [
                                'name'    => 'mall/order/order',
                                'title'   => '订单管理',
                                'icon'    => 'fa fa-money',
                                'sublist' => [
                                    ['name' => 'mall/order/order/index', 'title' => 'View'],
                                    ['name' => 'mall/order/order/print', 'title' => 'Print'],
                                    ['name' => 'mall/order/order/detaill', 'title' => 'Detail'],
                                ]
                            ],
                            [
                                'name'    => 'mall/order/complain',
                                'title'   => '订单投诉',
                                'icon'    => 'fa fa-exclamation-triangle',
                                'sublist' => [
                                    ['name' => 'mall/order/complain/index', 'title' => 'View'],
                                    ['name' => 'mall/order/complain/add', 'title' => 'Add'],
                                    ['name' => 'mall/order/complain/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/order/complain/del', 'title' => 'Del'],
                                    ['name' => 'mall/order/complain/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/order/refund',
                                'title'   => '退款处理',
                                'icon'    => 'fa fa-undo',
                                'sublist' => [
                                    ['name' => 'mall/order/refund/index', 'title' => 'View'],
                                    ['name' => 'mall/order/refund/add', 'title' => 'Add'],
                                    ['name' => 'mall/order/refund/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/order/refund/del', 'title' => 'Del'],
                                    ['name' => 'mall/order/refund/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/order/invoice',
                                'title'   => '发票信息',
                                'icon'    => 'fa fa-map-o',
                                'sublist' => [
                                    ['name' => 'mall/order/invoice/index', 'title' => 'View'],
                                    ['name' => 'mall/order/invoice/add', 'title' => 'Add'],
                                    ['name' => 'mall/order/invoice/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/order/invoice/del', 'title' => 'Del'],
                                    ['name' => 'mall/order/invoice/multi', 'title' => 'Multi'],
                                ]
                            ],
                            
                        ],
                    ],
                    [
                        'name'    => 'mall/shop',
                        'title'   => '商铺',
                        'icon'    => 'fa fa-bank',
                        'sublist' => [
                            [
                                'name'    => 'mall/shop/shop',
                                'title'   => '商铺管理',
                                'icon'    => 'fa fa-bank',
                                'sublist' => [
                                    ['name' => 'mall/shop/shop/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/shop/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/shop/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/shop/del', 'title' => 'Del'],
                                    ['name' => 'mall/shop/shop/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/shop/settlement',
                                'title'   => '订单结算',
                                'icon'    => 'fa fa-calculator',
                                'sublist' => [
                                    ['name' => 'mall/shop/settlement/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/settlement/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/settlement/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/settlement/del', 'title' => 'Del'],
                                    ['name' => 'mall/shop/settlement/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/shop/accred',
                                'title'   => '认证标志',
                                'icon'    => 'fa fa-certificate',
                                'sublist' => [
                                    ['name' => 'mall/shop/accred/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/accred/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/accred/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/accred/del', 'title' => 'Del'],
                                    ['name' => 'mall/shop/accred/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/shop/cat',
                                'title'   => '商品小类',
                                'icon'    => 'fa fa-th',
                                'sublist' => [
                                    ['name' => 'mall/shop/cat/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/cat/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/cat/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/cat/del', 'title' => 'Del'],
                                    ['name' => 'mall/shop/cat/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/shop/set',
                                'title'   => '商铺设置',
                                'icon'    => 'fa fa-cogs',
                                'sublist' => [
                                    ['name' => 'mall/shop/set/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/set/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/set/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/set/del', 'title' => 'Del'],
                                    ['name' => 'mall/shop/set/multi', 'title' => 'Multi'],
                                ],
                            ],

                        ],
                    ],                
                    [
                        'name'    => 'mall/user',
                        'title'   => '用户',
                        'icon'    => 'fa fa-user-circle',
                        'sublist' => [
                            [
                                'name'    => 'mall/user/favorite',
                                'title'   => '收藏管理',
                                'icon'    => 'fa fa-tags',
                                'sublist' => [
                                    ['name' => 'mall/user/favorite/index', 'title' => 'View'],
                                    ['name' => 'mall/user/favorite/add', 'title' => 'Add'],
                                    ['name' => 'mall/user/favorite/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/user/favorite/del', 'title' => 'Del'],
                                    ['name' => 'mall/user/favorite/multi', 'title' => 'Multi'],
                                ]
                            ],
                        	[
                        		'name'    => 'mall/user/address',
                        		'title'   => '地址管理',
                        		'icon'    => 'fa fa-address-book',
                        		'sublist' => [
                        			['name' => 'mall/user/address/index', 'title' => 'View'],
                        			['name' => 'mall/user/address/edit', 'title' => 'Edit'],
                        			['name' => 'mall/user/address/del', 'title' => 'Del'],
                        			['name' => 'mall/user/address/multi', 'title' => 'Multi'],
                        		]
                        	],
                        		
                        ]
                    ]
                ]
            ]
        ];
        
        //用户端菜单        
        $usermenu = [
            [
                'name'    => 'buyer',
                'title'   => '买家中心',
                'icon'    => 'fa fa-cart-plus',
                'sublist' => [
                    [
                        'name'    => 'mall/order',
                        'title'   => '订单',
                        'icon'    => 'fa fa-money',
                        'sublist' => [
                            [
                                'name'    => 'mall/order/myorder',
                                'title'   => '我的订单',
                                'icon'    => 'fa fa-money',
                                'sublist' => [
                                    ['name' => 'mall/order/myorder/index', 'title' => 'View'],
                                    ['name' => 'mall/order/order/detail', 'title' => 'Detail'],
                                    ['name' => 'mall/order/myorder/notice', 'title' => '催货'],
                                    ['name' => 'mall/order/myorder/cancel', 'title' => 'Cancel'],
                                    ['name' => 'mall/order/myorder/receive', 'title' => '收货'],
                                    ['name' => 'mall/order/myorder/reject', 'title' => '拒收'],
                                    ['name' => 'mall/order/myorder/appraise', 'title' => '评价'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/myappraise',
                                'title'   => '我的评价',
                                'icon'    => 'fa fa-comment-o',
                                'sublist' => [
                                    ['name' => 'mall/goods/myappraise/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/myappraise/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/myappraise/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/myappraise/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/order/mycomplain',
                                'title'   => '我的投诉',
                                'icon'    => 'fa fa-exclamation-triangle',
                                'sublist' => [
                                    ['name' => 'mall/order/mycomplain/index', 'title' => 'View'],
                                    ['name' => 'mall/order/mycomplain/add', 'title' => 'Add'],
                                    ['name' => 'mall/order/mycomplain/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/order/mycomplain/detail', 'title' => 'Detail'],
                                    ['name' => 'mall/order/mycomplain/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/order/myrefund',
                                'title'   => '我的退款',
                                'icon'    => 'fa fa-undo',
                                'sublist' => [
                                    ['name' => 'mall/order/myrefund/index', 'title' => 'View'],
                                    ['name' => 'mall/order/myrefund/add', 'title' => 'Add'],
                                ]
                            ],

                        ]
                    ],
                    [
                        'name'    => 'mall/user',
                        'title'   => '扩展',
                        'icon'    => 'fa fa-puzzle-piece',
                        'sublist' => [
                            [
                                'name'    => 'mall/user/favorite',
                                'title'   => '我的收藏',
                                'icon'    => 'fa fa-tags',
                                'sublist' => [
                                    ['name' => 'mall/user/favorite/index', 'title' => 'View'],
                                    ['name' => 'mall/user/favorite/add', 'title' => 'Add'],
                                    ['name' => 'mall/user/favorite/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/user/favorite/del', 'title' => 'Del'],
                                    ['name' => 'mall/user/favorite/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/user/address',
                                'title'   => '地址管理',
                                'icon'    => 'fa fa-address-book-o',
                                'sublist' => [
                                    ['name' => 'mall/user/address/index', 'title' => 'View'],
                                    ['name' => 'mall/user/address/add', 'title' => 'Add'],
                                    ['name' => 'mall/user/address/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/user/address/del', 'title' => 'Del'],
                                    ['name' => 'mall/user/address/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/inform',
                                'title'   => '我的举报',
                                'icon'    => 'fa fa-shield',
                                'sublist' => [
                                    ['name' => 'mall/oper/inform/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/inform/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/inform/detail', 'title' => 'Detail'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/message',
                                'title'   => '消息管理',
                                'icon'    => 'fa fa-commenting-o',
                                'sublist' => [
                                    ['name' => 'mall/oper/message/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/message/add', 'title' => 'Add'],
                                    ['name' => 'mall/oper/message/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/oper/message/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/message/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/oper/notification',
                                'title'   => '通知管理',
                                'icon'    => 'fa fa-bell-o',
                                'sublist' => [
                                    ['name' => 'mall/oper/notification/index', 'title' => 'View'],
                                    ['name' => 'mall/oper/notification/del', 'title' => 'Del'],
                                    ['name' => 'mall/oper/notification/multi', 'title' => 'Multi'],
                                ]
                            ],

                        ]
                    ],
                ]
            ],
            [
                'name'    => 'mall',
                'title'   => '卖家中心',
                'icon'    => 'fa fa-thumbs-o-up',
                'sublist' => [
                    [
                        'name'    => 'mall/goods',
                        'title'   => '商品',
                        'icon'    => 'fa fa fa-barcode',
                        'sublist' => [
                            [
                                'name'    => 'mall/goods/goods',
                                'title'   => '商品管理',
                                'icon'    => 'fa fa-barcode',
                                'sublist' => [
                                    ['name' => 'mall/goods/goods/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/goods/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/goods/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/goods/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/goods/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/goodsattr',
                                'title'   => '商品属性',
                                'icon'    => 'fa fa-list-ul',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/goodsattr/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/goodsattr/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/goodsattr/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/goodsattr/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/goodsattr/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/salespec',
                                'title'   => '销售规格',
                                'icon'    => 'fa fa-list-ul',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/salespec/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/salespec/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/salespec/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/salespec/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/salespec/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/specitem',
                                'title'   => '规格项',
                                'icon'    => 'fa fa-list-ul',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/goods/specitem/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/specitem/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/specitem/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/specitem/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/specitem/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/goods/appraise',
                                'title'   => '商品评价',
                                'icon'    => 'fa fa-comment-o',
                                'sublist' => [
                                    ['name' => 'mall/goods/appraise/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/appraise/edit', 'title' => 'Edit'],
                                ],
                            ],
                            [
                                'name'    => 'mall/goods/consult',
                                'title'   => '商品咨询',
                                'icon'    => 'fa fa-handshake-o',
                                'sublist' => [
                                    ['name' => 'mall/goods/consult/index', 'title' => 'View'],
                                    ['name' => 'mall/goods/consult/add', 'title' => 'Add'],
                                    ['name' => 'mall/goods/consult/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/goods/consult/del', 'title' => 'Del'],
                                    ['name' => 'mall/goods/consult/multi', 'title' => 'Multi'],
                                ],
                            ],
                        ],
                    ],
                    [
                        'name'    => 'mall/order',
                        'title'   => '订单',
                        'icon'    => 'fa fa-money',
                        'sublist' => [
                            [
                                'name'    => 'mall/order/order',
                                'title'   => '订单管理',
                                'icon'    => 'fa fa-money',
                                'sublist' => [
                                    ['name' => 'mall/order/order/index', 'title' => 'View'],
                                    ['name' => 'mall/order/order/editmoney', 'title' => '改价'],
                                    ['name' => 'mall/order/order/deliver', 'title' => '发货'],
                                    ['name' => 'mall/order/order/detail', 'title' => 'Detail'],
                                    ['name' => 'mall/order/order/printf', 'title' => '打印'],
                                    ['name' => 'mall/order/order/settlement', 'title' => '结算'],
                                    ['name' => 'mall/order/order/settlemented', 'title' => '已结算'],
                                    ['name' => 'mall/order/order/unsettlement', 'title' => '未结算'],
                                ]
                            ],
                            [
                                'name'    => 'mall/order/complain',
                                'title'   => '订单投诉',
                                'icon'    => 'fa fa-exclamation-triangle',
                                'sublist' => [
                                    ['name' => 'mall/order/complain/index', 'title' => 'View'],
                                    ['name' => 'mall/order/complain/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/order/complain/detail', 'title' => 'Detail'],
                                    ['name' => 'mall/order/complain/multi', 'title' => 'Multi'],
                                ]
                            ],
                            [
                                'name'    => 'mall/order/refund',
                                'title'   => '退款处理',
                                'icon'    => 'fa fa-undo',
                                'sublist' => [
                                    ['name' => 'mall/order/refund/index', 'title' => 'View'],
                                    ['name' => 'mall/order/refund/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/order/refund/multi', 'title' => 'Multi'],
                                ]
                            ],
                            
                        ],
                    ],
                    [
                        'name'    => 'mall/shop',
                        'title'   => '店铺',
                        'icon'    => 'fa fa-bank',
                        'sublist' => [
                            [
                                'name'    => 'mall/shop/shop',
                                'title'   => '商铺信息',
                                'icon'    => 'fa fa-bank',
                                'sublist' => [
                                    ['name' => 'mall/shop/shop/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/shop/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/shop/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/shop/settlement',
                                'title'   => '订单结算',
                                'icon'    => 'fa fa-calculator',
                                'sublist' => [
                                    ['name' => 'mall/shop/settlement/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/settlement/detail', 'title' => 'Detail'],
                                ]
                            ],
                            [
                                'name'    => 'mall/shop/cat',
                                'title'   => '商品小类',
                                'icon'    => 'fa fa-th',
                                'sublist' => [
                                    ['name' => 'mall/shop/cat/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/cat/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/cat/edit', 'title' => 'Edit'],
                                    ['name' => 'mall/shop/cat/del', 'title' => 'Del'],
                                    ['name' => 'mall/shop/cat/multi', 'title' => 'Multi'],
                                ],
                            ],
                            [
                                'name'    => 'mall/shop/set',
                                'title'   => '商铺设置',
                                'icon'    => 'fa fa-cogs',
                                'sublist' => [
                                    ['name' => 'mall/shop/set/index', 'title' => 'View'],
                                    ['name' => 'mall/shop/set/add', 'title' => 'Add'],
                                    ['name' => 'mall/shop/set/edit', 'title' => 'Edit'],
                                ],
                            ],
                            [
                                'name'    => 'mall/shop/freight',
                                'title'   => '运费设置',
                                'icon'    => 'fa fa-truck',
                                'sublist' => [
                                    ['name' => 'mall/shop/freight/index', 'title' => '查看'],
                                    ['name' => 'mall/shop/freight/add', 'title' => '添加'],
                                    ['name' => 'mall/shop/freight/edit', 'title' => '修改'],
                                    ['name' => 'mall/shop/freight/del', 'title' => '删除'],
                                    ['name' => 'mall/shop/freight/multi', 'title' => '批量更新'],
                                ]
                            ],
                            [
                                'name'    => 'mall/shop/freightprice',
                                'title'   => '快递报价',
                                'icon'    => 'fa fa-truck',
                                'ismenu'  => 0,
                                'sublist' => [
                                    ['name' => 'mall/shop/freightprice/index', 'title' => '查看'],
                                    ['name' => 'mall/shop/freightprice/add', 'title' => '添加'],
                                    ['name' => 'mall/shop/freightprice/edit', 'title' => '修改'],
                                    ['name' => 'mall/shop/freightprice/del', 'title' => '删除'],
                                    ['name' => 'mall/shop/freightprice/multi', 'title' => '批量更新'],
                                ]
                            ],

                        ],
                    ],
                ]
            ]
        ];
        
        //创建后台菜单
        Menu::create($adminmenu);
        //创建用户端菜单
        UserMenu::create($usermenu);

        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        return Menu::delete("mall")
            && UserMenu::delete("mall")
            && UserMenu::delete("buyer");

    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        return Menu::enable('mall')
            && UserMenu::enable('mall')
            && UserMenu::enable('buyer');

    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        return Menu::disable('mall')
            && UserMenu::disable('mall')
            && UserMenu::disable('buyer');

    }

    /**
     * 创建会员附表记录
     * @param \app\common\model\User $user
     */
    public function userRegisterSuccessed(\app\common\model\User $user)
    {
        $data = [
            'user_id' => $user->id
        ];
        User::create($data);
    }

    /**
     * 删除会员附表记录
     * @param \app\common\model\User $user
     */
    public function userDeleteSuccessed(\app\common\model\User $user)
    {
        User::where('user_id', $user->id)->delete();
    }

    /**
     * 原生会员中心边栏后
     * @return mixed
     * @throws \Exception
     */
    public function userSidenavAfter()
    {   //从原生会员中心跳到扩展会员中心
        return $this->fetch('view/hook/user_sidenav_after');
    }

    /**
     * 扩展会员中心消息提醒
     * @return mixed
     * @throws \Exception
     */
    public function userMessages()
    {
        $usermall = \addons\mall\model\User::get(cookie("uid"));
        //设置消息
        $messages=[];
        $messages["count"]=$usermall['notices'];
        $messages["url"] = "/user/mall/oper/notification?ref=addtabs";
        $data = [
            'messages' => $messages
        ];
        return $this->fetch('view/hook/user_messages', $data);
    }

    /**
     * 扩展会员中心控制台
     * @return mixed
     * @throws \Exception
     */
    public function userDashboardAfter()
    {
        $row = new \app\user\controller\mall\Dashboard();
        $buyer = $row->getBuyerInfo();
        if(!cookie("shop_id")){
            return $this->fetch($row->addHtmlRow(),[
                "buyer"        =>$buyer,
            ]);
        }
        else{
            $seller = $row->getSellerInfo();
            $order = $row->getOrders();
            return $this->fetch($row->addHtmlRow(),[
                "buyer"        =>$buyer,
                "seller"       =>$seller,
                'column'       =>$order["column"],
                'orderList'    =>$order["orderList"],
                'orderSrc'     =>$order["orderSrc"],
            ]);
        }
    }

}
